package model.ability;

import model.core.Logger;
import model.entity.Entity;

public class Enchant extends InteractiveAbility {
	private int enchantDuration;
	/**
	 * Constructor for Enchant.
	 * @param name
	 * @param ps
	 * @param mana
	 * @param delay
	 */
	public Enchant(String name, PassiveSkill ps, int mana, int delay,
			int enchantDuration) {
		super(name, ps, mana, delay);
		this.enchantDuration = enchantDuration;
	}

	/**
	 * Enchant interaction.  
	 */
	public void interactWithTarget(Entity caster, Entity target) {
		if(this.testProbability())
			this.enchantTarget(target);
		else{
			target.makeHostile(caster);
			Logger.getInstance().writeToLogger("Ability failed!");
		}
	}
	
	/**
	 * Enchant target by PassiveSkillLevelMultiplier.
	 */
	public void enchantTarget(Entity target){
		int enchantAmount = (int)(this.getSkillLevelMultiplier());
		target.affectFavorability(enchantAmount, enchantDuration);
	}

}
